/*
 * Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
 *
 * https://www.gz-yami.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */

package com.yami.shop.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yami.shop.common.util.KdApiSearchDemo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.yami.shop.bean.model.Delivery;
import com.yami.shop.dao.DeliveryMapper;

import com.yami.shop.service.DeliveryService;

/**
 *
 * @author lgh on 2018/11/26.
 */
@Service
public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> implements DeliveryService {

    @Autowired
    private DeliveryMapper deliveryMapper;


    @Override
    public Delivery getDeliveryByCode(String code) {

        Delivery one = getOne(Wrappers.lambdaQuery(new Delivery())
                .eq(Delivery::getDvyCode,code));
        return one;
    }

    @Cacheable(cacheNames = "dvy")
    @Override
    public String search(String dvyFlowId, String dvyCode) {
        String search = KdApiSearchDemo.search(dvyFlowId, dvyCode);
        return search;
    }
}
